//
//  RBApplyInvoiceVC.m
//  zhongzhenglu
//
//  Created by XL on 2022/7/15.
//

#import "RBApplyInvoiceVC.h"
#import "UIView+RBAdd.h"
#import "UIScrollView+RBAdd.h"
#import <Masonry.h>
#import "RBThemeConfig.h"
#import <UIColor+YYAdd.h>
#import <UIView+YYAdd.h>
#import "RanTool.h"
#import "RBPager.h"
#import <UINavigationController+FDFullscreenPopGesture.h>
#import "UIViewController+RBAdd.h"
#import "RBNavigationBar.h"
#import "RBGradientView.h"
#import "RBInvoiceNowVC.h"
#import "RBInvoiceListVC.h"
#import "RBInvoiceHeaderManageVC.h"

@interface RBApplyInvoiceVC ()

@property(nonatomic, strong)RBNavigationBar *navigationBar;
@property(nonatomic, strong)IBOutlet UIView *topView;

@end

@implementation RBApplyInvoiceVC

#pragma mark - Lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setup];
}

#pragma mark - Private

- (void)setup
{
    self.fd_prefersNavigationBarHidden = YES;
    self.view.backgroundColor = [RBThemeConfig bgGrayColor];
    RBGradientView *topBg = [RBGradientView gradientViewWithColors:@[[UIColor colorWithHexString:@"#CADCFF"], [RBThemeConfig bgGrayColor]] locations:nil vertical:YES];
    [self.view addSubview:topBg];
    [topBg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(0);
        make.height.mas_equalTo(Zoom(213));
    }];
    self.navigationBar.hidden = NO;
    [self.topView zoomSubViewsWithSelf];
    [self.view addSubview:self.topView];
    [self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.height.mas_equalTo(Zoom(self.topView.height));
        make.top.mas_equalTo(self.navigationBar.mas_bottom).offset(Zoom(18));
    }];
}

#pragma mark - Network

#pragma mark - Event

- (IBAction)itemTapped:(UIButton *)btn
{
    switch (btn.tag) {
        case 0:
        {
            RBInvoiceNowVC *vc = RBInvoiceNowVC.new;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 1:
        {
            RBInvoiceListVC *vc = RBInvoiceListVC.new;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 2:
        {
            RBInvoiceHeaderManageVC *vc = RBInvoiceHeaderManageVC.new;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        default:
            break;
    }
}

#pragma mark - Setter

#pragma mark - Getter

- (RBNavigationBar *)navigationBar
{
    if (!_navigationBar)
    {
        self.navigationBar = ({
            RBNavigationBar *bar = RBNavigationBar.new;
            bar.needGradientView = NO;
            [self.view addSubview:bar];
            [bar mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.top.right.mas_equalTo(0);
                make.height.mas_equalTo(kRBStatusBarHeight + kRBNavigationBarHeight);
            }];
            [bar.naviBar addBackBtnWithWidth:70 image:[UIImage imageNamed:@"backBlack"]];
            UILabel *titleL = [RanTool labelWithFontSize:Zoom(16) weight:1 color:[RBThemeConfig textBlackColor] align:0 text:@"申请发票"];
            [bar.naviBar addSubview:titleL];
            [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
                make.center.mas_equalTo(0);
            }];
            bar;
        });
    }
    return _navigationBar;
}


@end
